package edu.kjxy.day01.t12;

/**
 * 功能:判断是否停止线程
 * 作者:程序员欧阳子韩
 * 日期:2024/1/31 19:51
 */
public class RunTest {
    public static void main(String[] args) {
        try {
            MyThread myThread = new MyThread();
            myThread.start();
            Thread.sleep(1000);
            myThread.interrupt();
//            Thread.currentThread().interrupt();
            System.out.println("是否停止1? =" + myThread.interrupted());//当前线程是否已经中断
            System.out.println("是否停止2? =" + myThread.interrupted());
        }catch (InterruptedException e){
            e.printStackTrace();
        }
        System.out.println("end");
    }
}
